def mailSend(to_mail,code):
  '''
  发送邮件函数
  '''
  import mailSetting
  from smtplib import SMTP_SSL
  from email.mime.text import MIMEText
  from email.mime.multipart import MIMEMultipart
  from email.header import Header

  msg = MIMEMultipart()
  msg['Subject'] = Header('邮箱绑定验证码','utf-8')
  msg['From'] = str(mailSetting.message_from_callsign)
  msg["To"] = str(to_mail)
  msg.attach(MIMEText('验证码：{}'.format(code),'html'))

  server = SMTP_SSL(mailSetting.mail_server)
  server.login(mailSetting.mail_host_user,mailSetting.pass_code)

  server.sendmail(mailSetting.mail_host_user,str(to_mail),msg.as_string())
  server.quit()
